import { createStore } from 'vuex'
const MEMBER = "MEMBER";
export default createStore({

  state: {
    // || {}可以避免空指针异常
    member: window.SessionStorage.get(MEMBER) || {}
  },
  getters: {
  },
  // 设置值
  mutations: {
    steMember (state, _member) {
      state.member = _member;
      window.SessionStorage.set(MEMBER, _member);
    }
  },
  // 异步任务
  actions: {
  },
  modules: {
    // a: {
    //   state: {
    //     member: {}
    //   },
    //   getters: {
    //   },
    //   mutations: {
    //     steMember (state, _member) {
    //       state.member = _member
    //     }
    //   },
    //   // 异步任务
    //   actions: {
    //   }
    // }
  }
})
